from base.base_other_page import BaseObject, BaseOperate
from config import BaseDir


class ArchitecturePage(BaseObject):
    """
    家园沙盘页-建筑(所有建筑沙盘存放)
    """

    def __init__(self):
        super().__init__()
        # 水晶祭坛
        self.crystal_altar = BaseDir + r"/icon/img_1.png"
        # 水晶祭坛英雄按钮
        self.crystal_altar_hero_btn = "英雄", "Name"

    # 定位水晶祭坛
    def find_crystal_altar(self):
        return self.crystal_altar

    # 定位水晶祭坛英雄按钮
    def find_crystal_altar_hero_btn(self):
        return self.get_name_and_text(self.crystal_altar_hero_btn)


class ArchitectureOperate(BaseOperate):
    def __init__(self):
        self.ap = ArchitecturePage()

    # 点击水晶祭坛
    def touch_crystal_altar(self):
        self.touch_goods(self.ap.find_crystal_altar())

    # 点击英雄按钮
    def click_crystal_altar_hero_btn(self):
        self.ap.find_crystal_altar_hero_btn().click()


class ArchitectureBusiness:
    def __init__(self):
        self.ao = ArchitectureOperate()

    # 点击水晶祭坛-点击
    def open_crystal_altar(self):
        """
        点击水晶祭坛
        :return:
        """
        # 点击水晶祭坛
        self.ao.touch_crystal_altar()
        # 点击英雄
        self.ao.click_crystal_altar_hero_btn()
